<template>
	<view class="rentClass">
		<view class="mbox marginTop20 marginBottom20" v-for="(val,i) in callist" :key='i'>
			<view class="title shuxian">{{val.name}}</view>
			<view class="list">
				<view class="box" v-for="(v,e) in val.children" :key='e'  @tap="tocallist(v.id)">
					<image :src="v.icon" mode=""></image>
					<view class="word">{{v.name}}</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				callist:[],
			}
		},
		onLoad() {
			this.getclass()
		},
		methods: {
			getclass() {
				this.http('/api/category/index', 'post', {}, )
					.then((res) => {
						this.callist = res.data
						console.log(this.callist)
					})
			},
			tocallist(v){
				console.log(v)
				uni.navigateTo({
					url: '/pages/index/rent/rentClassList?id=' + v
				});
			}
		}
	}
</script>

<style lang="less">
	.rentClass {
		padding: 0 40rpx;

		.mbox {
			.title {
				font-size: 36rpx;
				font-weight: bold;
				padding-left: 14rpx;
			}

			.list {
				// margin-top: 40rpx;
				padding: 0 20rpx;
				display: flex;
				align-items: center;
				flex-wrap: wrap;
				width: calc(100% + 80rpx);
				overflow: hidden;

				.box {
					display: flex;
					align-items: center;
					flex-direction: column;
					margin-right: 80rpx;
					margin-top: 40rpx;

					image {
						width: 90rpx;
						height: 90rpx;
						border-radius: 50%;
					}

					.word {
						padding-top: 20rpx;
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>
